import Vue from "vue";
import Element from "element-ui";
import BaseIconFont from "@/components/BaseIconFont"; // IconFont
import BasePagination from "@/components/BasePagination"; // 分页
import BaseUpload from "@/components/BaseUpload"; // 上传
import BaseMultipleUpload from "@/components/BaseMultipleUpload"; // 上传
import BaseUploadFile from "@/components/BaseUploadFile"; // 上传
import BaseTreeSelect from "@/components/BaseTreeSelect"; // 树形下拉
import BaseTreeMultiple from "@/components/BaseTreeMultiple"; // 多选树形下拉
import BaseTreeRelevance from "@/components/BaseTreeRelevance"; // 多选树形下拉携带其他数据
import BaseLoading from "@/components/BaseLoading"; // loading组件
import SvgIcon from "@/components/SvgIcon"; // svg图标组件

// 业务公共组件
import ChoiceDetectionItemDialog from "@/components/ChoiceDetectionItemDialog/index.vue";

import ImportComponents from "@/components/ImportComponents/index.vue";
import BasePreviewFile from "@/components/PreviewFile";
import PreviewFileContent from "@/components/PreviewFile/PreviewFileContent";
import vuePreviewPicture from "vue-preview-picture";
import "normalize.css/normalize.css"; // a modern alternative to CSS resets
import "./styles/element-variables.scss";
import "@/styles/index.scss"; // global css
import "@/styles/table-filter.scss";
import "./utils/directive"; // menus auth
// 菜单图标
import "@/utils/menuIcon";
import "./icons"; // icon

import store from "./store";
import jsonView from "vue-json-views";
// iconFont
import "@/utils/iconfont";
import "./permission"; // permission control
import "./utils/error-log"; // error log
import * as filters from "./filters"; // global filters
import Helper from "@/utils/Helper.js"; // 导入通用辅助类
import Base from "@/api/Base.js";
import BaseVideoUpload from "@/components/BaseVideoUpload"; // 上传视频
// 全局域名
import { base, baseProtocol } from "@/utils/config";

import App from "./App";
import router from "./router";
// 国际化
import i18n from "./i18n";

Vue.prototype.$base = base;
Vue.prototype.$baseProtocol = baseProtocol;
Vue.prototype.Helper = Helper;
Vue.prototype.Base = Base;

// 全局修改默认配置，点击空白处不能关闭弹窗
Element.Dialog.props.closeOnClickModal.default = false;

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }
// 注册全局组件

// Vue.use(Element, {
//   size: Cookies.get('size') || 'medium' // set element-ui default size
// })
// 注册ElementUI
Vue.use(Element, { size: "small" });
// register global utility filters
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});
// 图片预览
Vue.use(vuePreviewPicture);
Vue.config.productionTip = false;
// 注册字体图标
Vue.component(BaseIconFont.name, BaseIconFont);
// 注册页脚
Vue.component(BasePagination.name, BasePagination);
// 注册上传组件
Vue.component(BaseUpload.name, BaseUpload);
Vue.component(BaseUploadFile.name, BaseUploadFile);
Vue.component(BaseMultipleUpload.name, BaseMultipleUpload);
Vue.component(BaseVideoUpload.name, BaseVideoUpload);
// 树形下拉
Vue.component(BaseTreeSelect.name, BaseTreeSelect);
// 多选树形下拉
Vue.component(BaseTreeMultiple.name, BaseTreeMultiple);
Vue.component(BaseTreeRelevance.name, BaseTreeRelevance);
Vue.component(jsonView.name, jsonView);
// loading组件
Vue.component(BaseLoading.name, BaseLoading);
Vue.component(SvgIcon.name, SvgIcon);

// 业务公共组件
Vue.component(ChoiceDetectionItemDialog.name, ChoiceDetectionItemDialog);
Vue.component(ImportComponents.name, ImportComponents);
Vue.component(BasePreviewFile.name, BasePreviewFile);
Vue.component(PreviewFileContent.name, PreviewFileContent);
new Vue({
  el: "#app",
  router,
  i18n,
  store,
  render: (h) => h(App),
});
